<template>
  <div>
      <el-breadcrumb separator-class="el-icon-arrow-right">
         <el-breadcrumb-item :to="{ path: '/rights' }">首页</el-breadcrumb-item>
         <el-breadcrumb-item>活动管理</el-breadcrumb-item>
       </el-breadcrumb>
       <el-table border :data='rightlist'>
           <el-table-column type="index" width="50"></el-table-column>
           <el-table-column label='权限名称' prop='authName' align='center'></el-table-column>
           <el-table-column label='路径' prop='path' align='center'></el-table-column>
           <el-table-column label='权限名称' >
               <template slot-scope="scope">
                   <el-button type="primary" v-if='scope.row.level==0' size='mini'>一级</el-button>
                   <el-button type="success" v-if='scope.row.level==1' size='mini'>二级</el-button>
                   <el-button type="danger" v-if='scope.row.level==2' size='mini'>三级</el-button>
               </template>
           </el-table-column>
       </el-table>
  </div>
</template>

<script>
export default {
    created(){
        this.getRightList()
    },
    data(){
        return {
            rightlist:[]
        }
    },
    methods:{
        async getRightList(){
            //获取权限列表
           const {data:res}=await this.$http.get('rights/list')
           if(res.meta.status!=200) return this.$message.error('获取数据失败')
           this.rightlist=res.data
        }
    }

}
</script>

<style>
   .el-table{
       margin: 10px;
   }
</style>